package com.wulaobo.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;
import java.util.List;

/**
 * @Author wuwenbo
 * @Date 2024/5/16 15:02
 * @ClassName: FromCollectionDemo
 * @Description: TODO
 */
public class FromCollectionDemo {

    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        List<Integer> data = Arrays.asList(1, 22, 3);
        DataStreamSource<Integer> streamSource = env.fromCollection(data);

        streamSource.print("aa");

        env.executeAsync();

        List<Integer> data2 = Arrays.asList(45,23,56,78,23,7899,346,90);
        DataStreamSource<Integer> streamSource1 = env.fromCollection(data2);

        streamSource1.print("bb");

        env.execute();

    }

}
